#pragma once
#include "common.h"

const double PI = 3.14159265358979323846;

struct Point2D
{
    Point2D () : x ( 0.0 ), y ( 0.0 ) {}
    Point2D ( double x, double y ) : x ( x ), y ( y ) {}

    double x;
    double y;
};

Point2D operator - ( const Point2D & p1, const Point2D & p2 );
Point2D operator * ( const Point2D & p1, double factor );

double Angle ( const Point2D & p1, const Point2D & p2 );

double Distance ( const Point2D & p1, const Point2D & p2 );

template<class T>
T sqr ( T a ) { return a * a; }

// from 0 to 1
double Rand();

QString SaveVector ( const QString fileName, const QVector<double> & vect );
QString SavePointVector ( const QString fileName, const QVector<Point2D> & vect );
